<template>
    <Modal
            width="800"
            v-model="visible"
            :title="title"
    >
        <div  style="height: 500px">
            <bar :xAxisData="bar.xAxisData" :legendData="bar.legendData" ref="bar"
                 :seriesData="bar.seriesData" :title="bar.title" style="width: 100%;" :height="barHeight"></bar>
        </div>
        <div slot="footer">
            <Button @click="cancel">取消</Button>
        </div>
    </Modal>
</template>

<script>
    import {Bar} from '@/views/common/echarts'

    export default {
        components: {
            Bar
        },
        data() {
            return {
                title: "",
                visible: false,
                disableSubmit: false,
                model: {},
                barHeight: "500px",
                show: false,
                bar: {
                    xAxisData: ['总金额', '增加总金额', '总户数', '总人数', '调标金额'],
                    seriesData: [
                        {name: '调标前', type: 'bar', data: []},
                        {name: '调标后', type: 'bar', data: []}
                    ],
                    legendData: ['调标前', '调标后'],
                    title: "模拟调标前后对比分析"
                },
            }
        },
        methods: {
            cancel() {
                this.visible = false;
            },
            edit(row) {
                this.visible = true
                this.model = Object.assign({}, row);
                this.bar.seriesData[0].data[0] = row.yjag0003;
                this.bar.seriesData[1].data[0] = row.yjag0012;
                this.bar.seriesData[0].data[1] = 0;
                this.bar.seriesData[1].data[1] = row.yjag0008;
                this.bar.seriesData[0].data[2] = row.yjag0004;
                this.bar.seriesData[1].data[2] = row.yjag0013;
                this.bar.seriesData[0].data[3] = row.yjag0005;
                this.bar.seriesData[1].data[3] = row.yjag0014;
                this.bar.seriesData[0].data[4] = row.yjag0016;
                this.bar.seriesData[1].data[4] = row.yjag0015;
                this.$nextTick(() => {
                    this.$refs.bar.drawLine();
                })
            },
        }
    }
</script>

<style scoped>

</style>